﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>基本设置</title>
<link href="__PUBLIC__/admin/css/xc.min.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/admin/css/xc.admin.css" rel="stylesheet" type="text/css" />
<link href="__PUBLIC__/lib/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.js"></script> 
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.admin.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/common-1.0.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
</head>
<body>
<nav class="breadcrumb">
  <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 系统设置 
  <a class="btn btn-success radius r mr-20 btn-shua" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="pd-20">
  <div id="tab-system" class="HuiTab">
    <div class="tabBar cl">
      <foreach name="set_nav" item="vo" key="k">
        <span <if condition="$k eq 'sBas'">class="current"</if>><a href="javascript:void(0)" data-url="{:U('Setup/index',array('type'=>$k))}" onclick="goset(this)">{$vo}</a></span>
      </foreach>     
    </div>
    <form action="" method="post" class="form form-horizontal" id="myform" enctype="multipart/form-data">
      <div class="tabCon">
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>网站状态：</label>
          <div class="formControls col-8 skin-minimal">
            <div class="radio-box"><input type="radio" id="bsta1" name="bsta" value="1" <if condition='($conf[bsta] eq 1)'>checked </if> ><label for="bsta1">开启</label></div>
            <div class="radio-box"><input type="radio" id="bsta2" name="bsta" value="0" <if condition='($conf[bsta] eq 0)'>checked </if> ><label for="bsta2">关闭</label></div>
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>关闭原因：</label>
          <div class="formControls col-8">
            <textarea id="breason" name="breason" class="textarea"  placeholder="关闭原因，说点吧..." dragonfly="true" onKeyUp="textarealength(this,100)">{$conf.breason}</textarea>
            <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>网站标题：</label>
          <div class="formControls col-8">
            <input type="text" id="etitle" name="etitle" value="{$conf.etitle}" placeholder="控制在25个字、50个字节以内" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>关键字：</label>
          <div class="formControls col-8">
            <input type="text" id="ekey" name="ekey" placeholder="关键词之间用英文(,)隔开，建议8个词" value="{$conf.ekey}" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>网站描述：</label>
          <div class="formControls col-8">
            <textarea id="edesc" name="edesc" class="textarea" dragonfly="true" placeholder="请编写站内描述，建议120个字左右" onKeyUp="textarealength(this,100)">{$conf.edesc}</textarea>
            <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>网站logo：</label>
          <div class="formControls col-5"> <span class="btn-upload form-group">
            <input class="input-text upload-url" type="text" id="logoImgUrl" name="logoImgUrl" readonly style="width:250px" value="{$conf.logoImgUrl}" placeholder="请上传图像文件" />
            <a href="javascript:;" class="a-upload" onchange="uploadImage('myfile','web','logo');"><input type="file" name="myfile" id="myfile" alt="上传文件">点击上传文件</a>	
            </span><br/><font color="#f00">*请上传宽度180X高度50像素图片</font>
          </div>
          <div class="formControls col-2">
            <img id="logoImg" src="__UPLOAD__/{$conf.logoImgUrl|default='img/no_image.jpg'}" style="width:180px; height:50px; float: left">
          </div>
        </div>
        <hr class="mt-10">
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>注册通道：</label>
          <div class="formControls col-8 skin-minimal">
            <div class="radio-box"><input type="radio" id="reg1" name="reg" value="1" <if condition='($conf[reg] eq 1)'>checked </if> ><label for="reg1">开启</label></div>
            <div class="radio-box"><input type="radio" id="reg0" name="reg" value="0" <if condition='($conf[reg] eq 0)'>checked </if> ><label for="reg0">关闭</label></div>
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>关闭注册原因：</label>
          <div class="formControls col-8">
            <textarea id="regyuan" name="regyuan" class="textarea"  placeholder="关闭注册原因，说点吧..." dragonfly="true" onKeyUp="textarealength(this,100)">{$conf.regyuan}</textarea>
            <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
          </div>
        </div>
        <hr class="mt-10">
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>平台商家名称：</label>
          <div class="formControls col-8">
            <input type="text" id="shopname" name="shopname" placeholder="请输入平台商家店铺名称" value="{$conf.shopname}" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>商家联系电话：</label>
          <div class="formControls col-8">
            <input type="text" id="shoptel" name="shoptel" placeholder="请输入商家联系电话" value="{$conf.shoptel}" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>备案信息：</label>
          <div class="formControls col-8">
            <input type="text" id="bbei" name="bbei" placeholder="请输入备案号信息" value="{$conf.bbei}" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>版权信息：</label>
          <div class="formControls col-8">
            <input type="text" id="bban" name="bban" placeholder="Copyright © 2017-2027 北京优特世纪公司旗下产品.保留所有权利。" value="{$conf.bban}" class="input-text">
          </div>
        </div>
        <div class="row cl">
          <label class="form-label col-2"><span class="c-red">*</span>统计代码：</label>
          <div class="formControls col-8">
            <textarea id="bzhan" name="bzhan" class="textarea">{$conf.bzhan}</textarea>
          </div>
        </div>
        <div class="row cl">
          <div class="col-10 col-offset-2">
            <input type="hidden" id="type" name="type" value="{$type}">
      		<button type="button" id="sub" name="sub" class="btn btn-primary radius " onClick="checkSubmit()"><i class='Hui-iconfont'>&#xe632;</i>&nbsp;保存</button>
          </div>
		</div>
      </div>
    </form>
    <!--<a href="{:U('Database/index',array('type'=>'export'))}">备份数据库</a>-->
    <!--<a href="{:U('Database/index',array('type'=>'import'))}">还原数据库</a>-->
  </div>
</div>
<script type="text/javascript">
//按回车件触发提交
document.onkeydown=function(event){
	var e = event || window.event || arguments.callee.caller.arguments[0];
	if(e && e.keyCode==13){ // enter 键
		checkSubmit();
	}
}; 
//提交数据
function checkSubmit()
{
	var bstate = $('input[name="bsta"]:checked').val();
	var breson = $.trim($('#breason').val());
	var etitle = $.trim($('#etitle').val());
	var ekey   = $.trim($('#ekey').val());
  var edesc  = $.trim($('#edesc').val());
	var imgurl = $.trim($('#logoImgUrl').val());
	var regsta = $('input[name="reg"]:checked').val();
	var regyuan= $.trim($('#regyuan').val());
	var bbei   = $.trim($('#bbei').val());
	var bban   = $.trim($('#bban').val());
	if(typeof(bstate) == "undefined"){ 
		layer.msg('网站状态未选择', {icon: 2});
		return false;
	}if(bstate== "0" && breson==''){ 
		layer.msg('网站关闭原因不能为空', {icon: 2});
		return false;
	}if(etitle == ''){
		layer.msg('网站标题不能为空', {icon: 2});
		return false;
	}if(ekey == ''){
		layer.msg('网站关键词不能为空!', {icon: 2});
		return false;
	}if(edesc == ''){
		layer.msg('网站描述不能为空!', {icon: 2});
		return false;
	}if(imgurl == ''){
		layer.msg('网站LOGO图片未上传!', {icon: 2});
		return false;
	}if(typeof(regsta) == "undefined"){ 
		layer.msg('注册通道未选择', {icon: 2});
		return false;
	}if(regsta== "0" && regyuan==''){ 
		layer.msg('关闭注册原因不能为空', {icon: 2});
		return false;
	}if(bbei==''){
		layer.msg('备案信息不能为空!', {icon: 2});
		return false;
	}if(bban==''){
		layer.msg('版权信息不能为空!', {icon: 2});
		return false;
	}
	$.ajax({
		type : 'post',
		url : '__MODULE__/Setup/setupUpdate',
		data : $("#myform").serialize(),
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				layer.msg(res.msg,{icon:1});
				window.location.href = res.url;
			}else{
				layer.msg(res.msg, {icon: 2});
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			layer.alert('网络失败，请刷新页面后重试',{icon:2});
		}
	})
}
</script>
<!-- 图片上传 -->
<style type="text/css">
#file_upload{ float:right}
#file_upload-queue{ display:none}
</style>
<link href="__PUBLIC__/lib/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/lib/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript"> 
$(function() {
	$('#file_upload').uploadify({
        'swf'      : '__PUBLIC__/lib/uploadify/uploadify.swf',
        'uploader' : '__MODULE__/Uploader/setupFile?id=web',
 		'buttonText' : '网站LOGO',
        'onUploadSuccess' : function(file, data, response) {
			$('#bimg').attr('src','__UPLOAD__/'+ data);
			$('#bimgurl').val(data);
        },
    });

});
</script>
<!-- 图片上传 -->

<!-- 单选 复选框 -->
<link href="__PUBLIC__/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
});
</script>
<!-- 单选 复选框 -->
</body>
</html>